Object persistence is often viewed by software developers as a raw data stream containing information from which objects can be instantiated and loaded with state. In embedded applications, it is useful to hard-code object persistence. Hard-coded object persistence refers to the coding of objects and their state directly into an executable unit. Such an object persistence scheme is useful when an application has large amounts of pre-configured objects, where the performance of object creation and state loading is critical. In Visual C++, the optimization required to realize the performance of hard-coded objects is not implemented within the compiler.
Typical object persistence models suffer from a number of performance weaknesses. First, the necessity of factory functions generally dictates the use of dynamic allocation of objects through operator new( ). Heap management routines may be slow and unreliable. Furthermore, locality of reference issues may result in poor performance. Second, objects must assign attribute values read from a persistent data stream. Reading data from a data stream not only consumes execution time, but also results in excess program code. Finally, pointers to objects that have yet to be created must be resolved following their creation.
A method and apparatus that addresses the aforementioned problems, as well as other related problems, are therefore desirable.